Download Java SE 7 Programmer I.1Z0-803.ExamDumps.2017-06-06.213q.vcex

Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I
Date: Jun 06, 2017
File Size: 21 MB

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

ProfExam Discount

Demo Questions

Question 1
Given:
public class App {
// Insert code here
System.out.print("Welcome to the world of Java");
}
}
Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen?
  1. static public void main (String [] args) {
  2. static void main (String [] args) {
  3. public static void Main (String [] args) {
  4. public static void main (String [] args) {
  5. public void main (String [] args) {
Correct answer: AD
Explanation:
Incorrect:Not B: No main class found.Not C: Main method not found notE: Main method is not static.
Incorrect:
Not B: No main class found.
Not C: Main method not found not
E: Main method is not static.
Question 2
Given the code fragment:
public class Test {
public static void main(String[] args) {
boolean isChecked = false;
int arry[] = {1,3,5,7,8,9};
int index = arry.length;
while ( <code1> ) {
if (arry[index-1] % 2 ==0) {
isChecked = true;
}
<code2>
}
System.out.print(arry(index]+", "+isChecked));
}
}
Which set of changes enable the code to print 1, true?
  1. Replacing <code1> with index > 0 and replacing <code2> with index-;
  2. Replacing <code1> with index > 0 and replacing <code2> with -index;
  3. Replacing <code1> with index > 5 and replacing <code2> with -index ;
  4. Replacing <code1> with index and replacing <code2> with -index ;
Correct answer: A
Explanation:
Note: Code in B (code2 is -index;). also works fine.
Note: Code in B (code2 is -index;). also works fine.
Question 3
Given:
public class TestLoop {
public static void main(String[] args) {
int array[] = {0, 1, 2, 3, 4};
int key = 3;
for (int pos = 0; pos < array.length; ++pos) {
if (array[pos] == key) {
break;
}
}
System.out.print("Found " + key + "at " + pos);
}
}
What is the result?
  1. Found 3 at 2
  2. Found 3 at 3
  3. Compilation fails
  4. An exception is thrown at runtime
Correct answer: C
Explanation:
The following line does not compile:System.out.print("Found " + key + "at " + pos);The variable pos is undefined at this line, as its scope is only valid in the for loop.Any variables created inside of a loop are LOCAL TO THE LOOP.
The following line does not compile:
System.out.print("Found " + key + "at " + pos);
The variable pos is undefined at this line, as its scope is only valid in the for loop.
Any variables created inside of a loop are LOCAL TO THE LOOP.
Question 4
Given the code fragment:
public class ForTest {
public static void main(String[] args) {
int[] array = {1, 2, 3};
for ( foo ) {
}
}
Which three code fragments, when replaced individually for foo, enables the program to compile?
  1. int i : array
  2. int i = 0; i < 1;
  3. ; ;
  4. ; i < 1; i++
  5. i = 0; i<1;
Correct answer: ABC
Question 5
Given:
abstract class A1 {
public abstract void m1();
public void m2() { System.out.println("Green"); }
}
abstract class A2 extends A1 {
public abstract void m3();
public void m1() { System.out.println("Cyan"); }
public void m2() { System.out.println("Blue"); }
}
public class A3 extends A2 {
public void m1() { System.out.println("Yellow"); }
public void m2() { System.out.println("Pink"); }
public void m3() { System.out.println("Red"); }
public static void main(String[] args) {
A2 tp = new A3();
tp.m1();
tp.m2();
tp.m3();
}
}
What is the result?
  1. YellowPink
    Red
  2. CyanBlue
    Red
  3. CyanGreen
    Red
  4. Compilation Fails
Correct answer: A
Explanation:
YellowPinkRed
Yellow
Pink
Red
Question 6
Which two statements correctly describe checked exception?
  1. These are exceptional conditions that a well-written application should anticipate and recover from.
  2. These are exceptional conditions that are external to the application, and that the application usually cannot anticipate or recover from.
  3. These are exceptional conditions that are internal to the application, and that the application usually cannot anticipate or recover from.
  4. Every class that is a subclass of RuntimeException and Error is categorized as checked exception.
  5. Every class that is a subclass of Exception, excluding RuntimeException and its subclasses, is categorized as checked exception.
Correct answer: AE
Explanation:
Reference: Checked versus unchecked exceptions
Reference: Checked versus unchecked exceptions
Question 7
Given:
public class ColorTest {
public static void main(String[] args) {
String[] colors = {"red", "blue","green","yellow","maroon","cyan"};
int count = 0;
for (String c : colors) {
if (count >= 4) {
break;
}
else {
continue;
}
if (c.length() >= 4) {
colors[count] = c.substring(0,3);
}
count++;
}
System.out.println(colors[count]);
}
}
What is the result?
  1. Yellow
  2. Maroon
  3. Compilation fails
  4. A StringIndexOutOfBoundsException is thrown at runtime.
Correct answer: C
Explanation:
The line, if (c.length() >= 4) {, is never reached. This causes a compilation error.Note: The continue statement skips the current iteration of a for, while , or do-while loop.An unlabeled break statement terminates the innermost switch, for, while, or do-while statement, but a labeled break terminates an outer statement.
The line, if (c.length() >= 4) {, is never reached. This causes a compilation error.
Note: The continue statement skips the current iteration of a for, while , or do-while loop.
An unlabeled break statement terminates the innermost switch, for, while, or do-while statement, but a labeled break terminates an outer statement.
Question 8
Given the code fragment:
for (int ii = 0; ii < 3;ii++) {
int count = 0;
for (int jj = 3; jj > 0; jj-) {
if (ii == jj) {
++count;
break;
}
}
System.out.print(count);
continue;
}
What is the result?
  1. 011
  2. 012
  3. 123
  4. 000
Correct answer: A
Question 9
Given the code fragment:
class Student {
int rollnumber;
String name;
List cources = new ArrayList();
// insert code here
public String toString() {
return rollnumber + " : " + name + " : " + cources;
}
}
And,
public class Test {
public static void main(String[] args) {
List cs = newArrayList(); cs.add("Java"); cs.add("C");
Student s = new Student(123,"Fred", cs);
System.out.println(s);
}
}
Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]?
  1. private Student(int i, String name, List cs) {/* initialization code goes here */
    }
  2. public void Student(int i, String name, List cs) {/* initialization code goes here */
    }
  3. Student(int i, String name, List cs) {/* initialization code goes here */
    }
  4. Student(int i, String name, ArrayList cs) {/* initialization code goes here */
    }
Correct answer: C
Explanation:
Incorrect:Not A: Student has private access line: Student s = new Student(123,"Fred", cs);Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs);
Incorrect:
Not A: Student has private access line: Student s = new Student(123,"Fred", cs);
Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs);
Question 10
Given:
interface Pet { }
class Dog implements Pet { }
public class Beagle extends Dog{ }
Which three are valid?
  1. Pet a = new Dog();
  2. Pet b = new Pet();
  3. Dog f = new Pet();
  4. Dog d = new Beagle();
  5. Pet e = new Beagle();
  6. Beagle c = new Dog();
Correct answer: ADE
Explanation:
Incorrect:Not B, not C: Pet is abstact, cannot be instantiated.Not F: incompatible type. Required Beagle, found Dog.
Incorrect:
Not B, not C: Pet is abstact, cannot be instantiated.
Not F: incompatible type. Required Beagle, found Dog.
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX AND EXAM FILES

Use ProfExam Simulator to open VCEX and EXAM files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!